<!doctype html>
<html lang="zh-CH">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
	<title>木投网--个人中心--提交订单</title>
	<link rel="stylesheet" href="/resource/css/mt_index.css">
	<link rel="stylesheet" href="/resource/css/mt_user.css">
</head>
<body>
<!-- 顶部 -->
<div class="head">
	<div class="top-nav">
		<div class="submit-main">
			<div class="left">
				<!-- 登录后 -->
				 <span class="login-after">
                    您好，{{session_get(UserEnum::USER_INFO_SESSION_KEY)->user_name}}（{{substr(session_get(UserEnum::USER_INFO_SESSION_KEY)->mobile,0,3)}}****{{substr(session_get(UserEnum::USER_INFO_SESSION_KEY)->mobile,7)}}）
                    <a href="/logout">退出</a>
                </span>
			</div>
			<div class="right">
					<ul>
						<li><a href="/user_account">我的木投网</a><span>|</span></li>
						<li><a href="/user_order?status=0">我的订单</a><span>|</span></li>
						<li><a href="javascript:;">在线客服</a><span>|</span></li>
						<li><span class="last">客服热线：400-036-7917</span></li>
					</ul>
			</div>
		</div>
	</div>
	<div class="top top-shopping">
		<div class="submit-main">
			<div class="logo left">
				<a href="javascript:;" class="left"><img src="/resource/img/logo.png" alt=""></a>
				<span>购物车</span>
			</div>
		</div>
	</div>
</div>	
<!-- 购物车提交订单 -->
<div class="shopping-submit submit-main">
	<form action="shop_generate_order" method="POST">
		<div class="submit-box">
			<div class="title">支付方式</div>
			<ul class="ul-pay">
				<li class="active">
					<div class="pay-box">
						<label for="top1">京东在线支付</label>
						<input type="radio" name="pay" id="top1" checked/>
					</div>
					<i></i>
				</li>
				<li>
					<div class="pay-box">
						<label for="top2">银联pos机支付</label>
						<input type="radio" name="pay" id="top2">
					</div>
					<i></i>
				</li>
			</ul>
		</div>
		<div class="submit-box">
			<div class="title">商品信息</div>
			<div class="table">
				<table>
					<thead>
						<tr>
							<th>商品信息</th>
							<th>单价</th>
							<th>数量</th>
							<th>合计（元）</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td class="shop-in">
								<a href="javascript:;" target="blank">
									<img src="{{$cart_info->product_img}}" alt="">
								</a>
								<a href="javascript:;" target="blank">{{$cart_info->product_name}}</a>
							</td>
							<td>￥{{$cart_info->price}}</td>
							<td>{{$cart_info->number}}</td>
							<td><span>￥{{$cart_info->price*$cart_info->number}}</span></td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="submit-wrap">
				<div class="money">应付总额：<span>￥1700.00</span></div>
				<div class="span">支付方式：京东支付</div>
				<a href="javascript:;" class="btn-submit right">提交订单</a>
			</div>
		</div>
	</form>
</div>
<!-- 添加新地址 -->
<div class="popup"></div>
<div class="popup-add address-new">
	<div class="popup-bg">
		<div class="add-til">
			<span>新建收货地址</span>
			<div class="login-close"></div>
		</div>
		<form action="" class="form">
			<div class="form-group">
				<label for="">收货人：</label>
				<input type="text" class="form-control" id="consignee">
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group">
				<label for="">联系方式：</label>
				<input type="text" class="form-control" id="mobile">
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group">
				<label for="">收货地址</label>
				<select name="" id="sel_province" class="form-control form-right" ></select>
				<select name="" id="sel_city" class="form-control"></select>
				<select name="" id="sel_area" class="hide form-control"></select>
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group">
				<label for="">详细地址</label>
				<input type="text" class="form-control" id="address">
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group form-left">
				<label for="check">
					<input type="checkbox" id="check" > 设为默认收货地址
				</label>
			</div>
			<div class="form-group">
				<button type="submit" class="btn-login" >保存</button>
			</div>
		</form>
	</div>
</div>
<div class="popup-add address-update">
	<div class="popup-bg">
		<div class="add-til">
			<span>修改地址</span>
			<div class="login-close"></div>
		</div>
		<form action="" class="form">
			<div class="form-group">
				<label for="">收货人：</label>
				<input type="text" class="form-control">
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group">
				<label for="">联系方式：</label>
				<input type="text" class="form-control">
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group">
				<label for="">收货地址</label>
				<select name="" id="sel_province1" class="form-control form-right"></select>
				<select name="" id="sel_city1" class="form-control"></select>
				<select name="" id="sel_area1" class="hide form-control"></select>
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group">
				<label for="">详细地址</label>
				<input type="text" class="form-control">
				<i class="i-red">*</i>
				<span></span>
			</div>
			<div class="form-group form-left">
				<label for="check">
					<input type="checkbox" id="check1" > 设为默认收货地址
				</label>
			</div>
			<div class="form-group">
				<button type="button" class="btn-login" rel="">保存</button>
			</div>
		</form>
	</div>
</div>
<!-- 底部 -->
<div class="foot">
	<div class="main">
		<div class="left">
			<div class="foot-nav">
				<dl>
				    <dt><span>如何买木材</span></dt>
				    <dd>
				    	<a href="javascript:;" target="_blank">如何委托找货</a> 
				    	<a href="javascript:;" target="_blank">如何自己找货</a>
				    	<a href="javascript:;" target="_blank">如何支付</a>
				    </dd>
				</dl>
				<dl>
				    <dt><span>如何卖木材</span></dt>
				    <dd>
				    	<a href="javascript:;" target="_blank">如何入驻木投网</a> 
				    	<a href="javascript:;" target="_blank">如何发布商品</a>
				    	<a href="javascript:;" target="_blank">如何收款</a>
				    </dd>
				</dl>
				<dl>
				    <dt><span>常见问题</span></dt>
				    <dd>
				    	<a href="javascript:;" target="_blank">采购流程</a> 
				    	<a href="javascript:;" target="_blank">委托物流</a>
				    	<a href="javascript:;" target="_blank">意见反馈</a>
				    </dd>
				</dl>
			</div>
			<div class="foot-info">
				<ul>
					<li><a href="javascript:;">关于我们</a><span>|</span></li>
					<li><a href="javascript:;">法律声明</a><span>|</span></li>
					<li><a href="javascript:;">诚聘英才</a><span>|</span></li>
					<li><a href="javascript:;">投资洽谈</a><span>|</span></li>
					<li><a href="javascript:;">联系我们</a><span>|</span></li>
					<li><a href="javascript:;">常见问题</a></li>
				</ul>
				<p>北京木投网科技有限公司 京ICP备15043001   Copyright © 2016  Mutouw.com 版权所有</p>
			</div>
		</div>
		<div class="foot-code right">
			<img src="/resource/img/foot_code.png" alt="">
		</div>
	</div>
</div>
<!-- 返回顶部 -->
<div class="pos-tooblar">
	<a href="javascript:;" class="pos-tooblar-time">
		<span class="tooblar-later"></span>
	</a>
	<a href="javascript:;" class="pos-tooblar-service">
		<span class="tooblar-later"></span>
	</a>
	<a href="javascript:;" class="pos-tooblar-tel">
		<span class="tooblar-later"></span>
	</a>
	<a href="javascript:;" class="pos-tooblar-top" id="backTop"></a>
</div>
<script src="/resource/js/jquery-1.11.3.min.js"></script>
<script src="/resource/js/mt_index.js"></script>
<script src="/resource/js/province_city.js"></script>
<script src="/resource/js/mt_showBo.js"></script>  <!-- 提示信息 -->
<script>
	region_init('sel_province','sel_city','sel_area');

	//提交新地址
	$('.address-new .btn-login').click(function(){
		var is_default;
		if($('#check').is(':checked')){
			is_default =1;
		}else{
			is_default =0;
		}
		var consignee = $('#consignee').val();
		var mobile = $('#mobile').val();
		var sel_province = $('#sel_province').val();
		var sel_city = $('#sel_city').val();
		var address = $('#address').val();

		$.ajax({
			url : '/update_address',
			type : "POST",
			data : {is_default:is_default,consignee:consignee,mobile:mobile,address_all:sel_province+"-"+sel_city,address:address},
			dataType : "json",
			cache:"false",
			timeout:30000,
			success : function(json) {
				if(json.code == 1){
					location=location
				}else{

				}
			}
		});
		//console.log(111);
	});

	$('.add-more .til a').click(function(){
		var address_id = $(this).attr('rel');
		Showbo.Msg.confirm('<img class="left" src="/resource/img/user_if.png" alt=""><span style="float:left;font-size:22px;">您确定要删除该地址吗？</span>',function(btn){
			if (btn == 'yes') {
				$.ajax({

					url : '/delete_address',
					type : "POST",
					data : {address_id:address_id},
					dataType : "json",
					cache:"false",
					timeout:30000,
					success : function(json) {
						if(json.code == 1){

							location=location
						}else{

						}
					}
				});

			}else{
				return false;
			};
		});
		$('input.btn+input.btn').css('margin-right','-12px');
	});

	$('a.acquiesce').click(function(){
		var address_id = $(this).attr('rel');

		$.ajax({

			url : '/default_address',
			type : "POST",
			data : {address_id:address_id},
			dataType : "json",
			cache:"false",
			timeout:30000,
			success : function(json) {
				if(json.code == 1){

					location=location
				}else{

				}
			}
		});
	});

	//修改地址
	$('.address-update .btn-login').click(function(){
		var address_id = $(this).attr('rel');
		var is_default;
		var $consignee = $('.address-update .form-group').eq(0).children('.form-control');
		var $mobile = $('.address-update .form-group').eq(1).children('.form-control');
		var address_all;
		var $address_province = $('#sel_province1');
		var $address_city = $('#sel_city1');
		var $address = $('.address-update .form-group').eq(3).children('.form-control');
		if($('#check1').is(':checked')){
			is_default =1;
		}else{
			is_default =0;
		}
		$.ajax({
			url : '/update_address',
			type : "POST",
			data : {address_id:address_id,is_default:is_default,consignee:$consignee.val(),mobile:$mobile.val(),address_all:$address_province.val()+"-"+$address_city.val(),address:$address.val()},
			dataType : "json",
			cache:"false",
			timeout:30000,
			success : function(json) {
				if(json.code == 1){
					location=location
				}else{

				}
			}
		});
		console.log($address_province.val());

	});
</script>
</body>
</html>